package action;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import timer.Time;

/**
 * 
 * 
 * @author Minodor
 * 
 *         Keeps track of all Actions within a Scenario
 */
public class ActionPool {
	private static ActionPool instance = new ActionPool();
	private static String currentDate;

	public static void add(ActionSInterface action) {
		action.setDate(currentDate);
		instance.allActions.add(action);
	}

	public static ActionSInterface get(int index) {
		return instance.allActions.get(index);
	}

	public static int getCount() {
		return instance.allActions.size();
	}

	private ArrayList<ActionSInterface> allActions;

	private ActionPool() {
		allActions = new ArrayList<ActionSInterface>();
		Date d = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		// setCurrentDate(sdf.format(d));
	}

	public static void clear() {
		instance.allActions.clear();
	}

	public static void setCurrentDate(String currentDate) {
		ActionPool.currentDate = currentDate;
		Time.addDate(currentDate);
	}

	public static String getCurrentDate() {
		return currentDate;
	}

}
